package com.example.bbs.listener;

import lombok.RequiredArgsConstructor;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
@RequiredArgsConstructor
public class PayStatusListener {

//监听处会自动创建交换机和队列
    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(name = "test.success.queue", durable = "true"),
            exchange = @Exchange(name = "test.topic"),
            key = "test.success"
    ))
    public void listenSuccess(String test){
        System.out.println("监听到消息："+test);
    }
}
